/*     */ package com.iris.egrant.web.struts2.tags;
/*     */ 
/*     */ import com.iris.egrant.app.utils.IrisStringUtils;
/*     */ import freemarker.template.Configuration;
/*     */ import freemarker.template.Template;
/*     */ import java.io.Writer;
/*     */ import java.util.HashMap;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import javax.servlet.jsp.JspException;
/*     */ import javax.servlet.jsp.tagext.BodyTagSupport;
/*     */ import net.sf.json.JSONSerializer;
/*     */ import org.springframework.context.i18n.LocaleContextHolder;
/*     */ import org.springframework.web.context.WebApplicationContext;
/*     */ import org.springframework.web.context.support.WebApplicationContextUtils;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class SelectTag
/*     */   extends BodyTagSupport
/*     */ {
/*     */   private static final long serialVersionUID = 1077194066541229822L;
/*  31 */   private String id = "";
/*     */   
/*  33 */   private String name = "";
/*     */   
/*  35 */   private String locale = "";
/*     */   
/*  37 */   private String key = "";
/*     */   
/*  39 */   private List<Map> data = null;
/*     */ 
/*     */   
/*  42 */   private String cacheable = "true";
/*     */   
/*  44 */   private String sqlParamVal = "";
/*     */ 
/*     */   
/*  47 */   private String className = "";
/*     */   
/*  49 */   private String value = "";
/*     */ 
/*     */   
/*  52 */   private String onChange = "";
/*     */   
/*  54 */   private String label = "";
/*     */ 
/*     */   
/*  57 */   private String hiddenParams = "";
/*     */   
/*  59 */   private String style = "";
/*     */   
/*     */   public String getCacheable() {
/*  62 */     return this.cacheable;
/*     */   }
/*     */   
/*     */   public void setCacheable(String cacheable) {
/*  66 */     this.cacheable = cacheable;
/*     */   }
/*     */   
/*     */   public String getSqlParamVal() {
/*  70 */     return this.sqlParamVal;
/*     */   }
/*     */   
/*     */   public void setSqlParamVal(String sqlParamVal) {
/*  74 */     this.sqlParamVal = sqlParamVal;
/*     */   }
/*     */   
/*     */   public String getLocale() {
/*  78 */     if (IrisStringUtils.isNullOrBlank(this.locale)) {
/*  79 */       return LocaleContextHolder.getLocale().toString();
/*     */     }
/*  81 */     return this.locale;
/*     */   }
/*     */   
/*     */   public void setLocale(String locale) {
/*  85 */     this.locale = locale;
/*     */   }
/*     */   
/*     */   public String getKey() {
/*  89 */     return this.key;
/*     */   }
/*     */   
/*     */   public void setKey(String key) {
/*  93 */     this.key = key;
/*     */   }
/*     */   
/*     */   public String getStyle() {
/*  97 */     return this.style;
/*     */   }
/*     */   
/*     */   public void setStyle(String style) {
/* 101 */     this.style = style;
/*     */   }
/*     */ 
/*     */   
/*     */   public List<Map> getData() {
/* 106 */     return this.data;
/*     */   }
/*     */ 
/*     */   
/*     */   public void setData(List<Map> data) {
/* 111 */     this.data = data;
/*     */   }
/*     */ 
/*     */   
/*     */   public int doStartTag() throws JspException {
/* 116 */     WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(this.pageContext.getServletContext());
/*     */ 
/*     */     
/* 119 */     Configuration cptFreemarkereConfiguration = (Configuration)context.getBean("cptFreemarkereConfiguration");
/*     */     
/*     */     try {
/* 122 */       String res = (String)this.pageContext.getAttribute("res");
/* 123 */       String ctx = (String)this.pageContext.getAttribute("ctx");
/*     */       
/* 125 */       Map<String, Object> params = new HashMap<String, Object>();
/* 126 */       params.put("key", this.key);
/* 127 */       params.put("sqlParamVal", this.sqlParamVal);
/* 128 */       params.put("cacheable", this.cacheable);
/* 129 */       params.put("locale", getLocale());
/*     */       
/* 131 */       Map<String, Object> rootMap = new HashMap<String, Object>();
/* 132 */       rootMap.put("res", res);
/* 133 */       rootMap.put("id", this.id);
/* 134 */       rootMap.put("name", (this.name.length() > 0) ? this.name : this.id);
/* 135 */       if (this.data != null) {
/* 136 */         rootMap.put("data", this.data);
/*     */       }
/*     */       
/* 139 */       rootMap.put("ctx", ctx);
/* 140 */       rootMap.put("params", JSONSerializer.toJSON(params).toString());
/* 141 */       rootMap.put("className", this.className);
/* 142 */       rootMap.put("value", this.value);
/* 143 */       rootMap.put("onChange", this.onChange);
/* 144 */       rootMap.put("label", this.label);
/* 145 */       rootMap.put("hiddenParams", this.hiddenParams.trim());
/* 146 */       rootMap.put("style", this.style);
/* 147 */       Template template = cptFreemarkereConfiguration.getTemplate("select.ftl", "utf-8");
/*     */       
/* 149 */       template.process(rootMap, (Writer)this.pageContext.getOut());
/*     */     }
/* 151 */     catch (Exception e) {
/* 152 */       throw new JspException(e);
/*     */     } 
/*     */     
/* 155 */     return 0;
/*     */   }
/*     */ 
/*     */   
/*     */   public String getId() {
/* 160 */     return this.id;
/*     */   }
/*     */ 
/*     */   
/*     */   public void setId(String id) {
/* 165 */     this.id = id;
/*     */   }
/*     */   
/*     */   public String getClassName() {
/* 169 */     return this.className;
/*     */   }
/*     */   
/*     */   public void setClassName(String className) {
/* 173 */     this.className = className;
/*     */   }
/*     */   
/*     */   public String getValue() {
/* 177 */     return this.value;
/*     */   }
/*     */   
/*     */   public void setValue(String value) {
/* 181 */     this.value = value;
/*     */   }
/*     */   
/*     */   public String getOnChange() {
/* 185 */     return this.onChange;
/*     */   }
/*     */   
/*     */   public void setOnChange(String onChange) {
/* 189 */     this.onChange = onChange;
/*     */   }
/*     */   
/*     */   public String getLabel() {
/* 193 */     return this.label;
/*     */   }
/*     */   
/*     */   public void setLabel(String label) {
/* 197 */     this.label = label;
/*     */   }
/*     */   
/*     */   public String getName() {
/* 201 */     return this.name;
/*     */   }
/*     */   
/*     */   public void setName(String name) {
/* 205 */     this.name = name;
/*     */   }
/*     */   
/*     */   public String getHiddenParams() {
/* 209 */     return this.hiddenParams;
/*     */   }
/*     */   
/*     */   public void setHiddenParams(String hiddenParams) {
/* 213 */     this.hiddenParams = hiddenParams;
/*     */   }
/*     */ }


/* Location:              D:\文件kjt\WEB-INF\lib\egrant-core-2.2.20240205.1659.jar!\com\iris\egrant\web\struts2\tags\SelectTag.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */